package test.util;

import java.io.File;
import java.io.IOException;

public class FileWork {
	
	private static final FileWork INSTANCE = new FileWork();
	
	public static FileWork getInstance() {
	      return INSTANCE;
	}
	
	/**
	 * Create file if it does not exist
	 * @param path - file directory + file
	 * @return
	 */
	public Boolean createFile(String path){
		try {
    		File file = new File(path);
    		boolean success = file.createNewFile();
    		return success;    		
        } catch (IOException e) {
        	System.err.println("Error: " + e.getMessage());
        	return false;
        }
	}
	
	/**
	 * Check if file exists in the directory
	 * @param path
	 * @return
	 */
	public Boolean existsFileOrDir(String path) {
        File f1 = new File(path);
        if(f1.exists()) {
            return true;
        } else {
        	return false;
        }
   }
}
